/**
 * 
 */
package com.sci.web.daoimpl;

import java.sql.SQLException;
import java.util.Map;

import org.springframework.orm.ibatis.SqlMapClientCallback;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.ibatis.sqlmap.client.SqlMapExecutor;

/**
 * @author  BaiFuyou
 * @date: Nov 13, 2011 10:19:22 AM
 */
public class DataCheckDao extends SqlMapClientDaoSupport implements com.sci.web.dao.DataCheckDao {

	/* (non-Javadoc)
	 * @see com.sci.web.dao.DataCheckDao#DataCheckPass(java.util.Map)
	 */
	@Override
	public boolean DataCheckPass(final Map<String, Object> map,final Map<String, Object> map1) {
		// TODO Auto-generated method stub
		this.getSqlMapClientTemplate().execute(new SqlMapClientCallback() {
			@Override
			public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException {
				executor.startBatch();	
				executor.update("datacheck.updatenterprisestatecheck",map);
				executor.update("datereportseason.updatecheckenterprise_attachmenttable",map1);
				executor.update("datereportseason.updatecheckenterprise_authenticationtable",map1);
				executor.update("datereportseason.updatecheckenterprise_benefittable",map1);
				executor.update("datereportseason.updatecheckenterprise_brandtable",map1);
				executor.update("datereportseason.updatecheckenterprise_fundstable",map1);
				executor.update("datereportseason.updatecheckenterprise_innovationtable",map1);
				executor.update("datereportseason.updatecheckenterprise_labor_capacitytable",map1);
				executor.update("datereportseason.updatecheckenterprise_managementtable",map1);
				executor.update("datereportseason.updatecheckenterprise_newtable",map1);
				executor.update("datereportseason.updatecheckenterprise_patenttable",map1);
				executor.update("datereportseason.updatecheckenterprise_projecttable",map1);
				executor.update("datereportseason.updatecheckenterprise_researchtable",map1);
				executor.update("datereportseason.updatecheckenterprise_rewardtable",map1);
				executor.update("datereportseason.updatecheckenterprise_standardtable",map1);
				executor.update("datereportseason.updatecheckenterprise_strategyable",map1);
				executor.executeBatch();
				return null;	
			}});
		return false;
	}

	/* (non-Javadoc)
	 * @see com.sci.web.dao.DataCheckDao#DateCheckNotPass(java.util.Map)
	 */
	@Override
	public boolean DateCheckNotPass(final Map<String, Object> map,final Map<String, Object> map1) {
		// TODO Auto-generated method stub
		this.getSqlMapClientTemplate().execute(new SqlMapClientCallback() {
			@Override
			public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException {
				executor.startBatch();	
				executor.update("datacheck.updatenterprisestatecheck",map);
				executor.update("datereportseason.updatecheckenterprise_attachmenttable",map1);
				executor.update("datereportseason.updatecheckenterprise_authenticationtable",map1);
				executor.update("datereportseason.updatecheckenterprise_benefittable",map1);
				executor.update("datereportseason.updatecheckenterprise_brandtable",map1);
				executor.update("datereportseason.updatecheckenterprise_fundstable",map1);
				executor.update("datereportseason.updatecheckenterprise_innovationtable",map1);
				executor.update("datereportseason.updatecheckenterprise_labor_capacitytable",map1);
				executor.update("datereportseason.updatecheckenterprise_managementtable",map1);
				executor.update("datereportseason.updatecheckenterprise_newtable",map1);
				executor.update("datereportseason.updatecheckenterprise_patenttable",map1);
				executor.update("datereportseason.updatecheckenterprise_projecttable",map1);
				executor.update("datereportseason.updatecheckenterprise_researchtable",map1);
				executor.update("datereportseason.updatecheckenterprise_rewardtable",map1);
				executor.update("datereportseason.updatecheckenterprise_standardtable",map1);
				executor.update("datereportseason.updatecheckenterprise_strategyable",map1);
				executor.executeBatch();
				return null;	
			}});
		return false;
	}

	/* (non-Javadoc)
	 * @see com.sci.web.dao.DataCheckDao#isTrueDataCheckPass(java.util.Map)
	 */
	@Override
	public boolean isTrueDataCheckPass(Map<String, Object> map) {
		// TODO Auto-generated method stub
		int length = -1;
		length = (Integer)super.getSqlMapClientTemplate().queryForObject("datacheck.istruecheckpass",map);
		return length==2;
	}

	/* (non-Javadoc)
	 * @see com.sci.web.dao.DataCheckDao#isTrueDateCheckNotPass(java.util.Map)
	 */
	@Override
	public boolean isTrueDateCheckNotPass(Map<String, Object> map) {
		// TODO Auto-generated method stub
		int length = -1;
		length = (Integer)super.getSqlMapClientTemplate().queryForObject("datacheck.istruechecknotpass",map);
		return length==5;
	}

}
